# #深浅拷贝
# import copy
# from copy import deepcopy
#
# a  = [1,2,3,4,[5,6,7],"123"]
#
# b = copy.copy(a)
#
# b[4][0] = 100
# b[5] = 100
# b[2] = 100
# print(id(a[4]))
# print(id(b[4]))
# print(a)
# #
# c = deepcopy(a)
# c[4][0] = 200
# c[2] = 200
# print(a,"................")
import json
import pickle
import time
from hashlib import md5
from urllib.parse import urlencode

#魔法方法
# class A:
#     def __init__(self,name,age):
#         self.name = name
#         self.age = age
#     def __str__(self):
#         return f"{self.name} {self.age}"
#     def __repr__(self):
#         return f"{self.name} {self.age}"
#     def __del__(self):
#         print("对象被删除")
#     def __call__(self, *args, **kwargs):
#         print("对象被调用")
#     def __enter__(self):
#         print("对象被进入")
#     def __exit__(self, exc_type, exc_val, exc_tb):
#         print("对象被退出")
#     def __getitem__(self, item):
#         print("对象被获取")
#         return item
#     def __setitem__(self, key, value):
#         print("对象被设置")
#         self.name = value
#     def __delitem__(self, key):
#         print("对象被删除")
#         del self.name
#     def __dir__(self):
#         print("对象被查询")
#     def __len__(self):
#         print("对象被查询长度")
#         return 0
#     def __le__(self, other):
#         print("对象被查询小于等于")
#     def __eq__(self, other):
#         print("对象被查询等于")
#
#     def __ne__(self, other):
#         print("对象被查询不等于")
#
#     def __gt__(self, other):
#         print("对象被查询大于")
#     def __lt__(self, other):
#         print("对象被查询小于")
#     def __ge__(self, other):
#         print("对象被查询大于等于")
#
#     def __add__(self, other):
#         print("对象被查询相加")
#     def __sub__(self, other):
#         print("对象被查询相减")
#     def __mul__(self, other):
#         print("对象被查询相乘")
#     def __truediv__(self, other):
#         print()
#


#动态性

# class Person:
#     pass
#
#
# Person.name = "张三"
#
# def func(self):
#     print("hello world",Person.name)
# Person.say_hello = func
# P = Person()
#
# P.say_hello()


#字符串处理方式
# string = "hello world"
#
# print(string.count("l"))
# print(string.find("l"))
# print(string.index("l"))
# print('a'.join(string))
# print(string.title())
# print(string.capitalize())
# print(string.endswith("d"))
# print(string.startswith("h"))
# print(string.replace("l","a"))
# print(string.lower())
# print(string.isdigit())
# print(string.split(" "))
# print(string.strip("h"))
# print(string.replace("l","a",1))
# print(string.rjust(20,"*"))





#序列化和反序列化

# datas = {"name":"张三","age":18}
# print(type(datas))
# json_data = json.dumps(datas)
# print(json_data,type(json_data))
#
# load_datas = json.loads(json_data)
# print(load_datas,type(load_datas))
#
#
# pickle_data  = pickle.dumps(datas)
# print(pickle_data,type(pickle_data))



#filter,map reduce
# from  functools import  reduce
# for i in   filter(lambda x: x < 3, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]):
#     print(i)
# map_data = map(lambda x: x * 2, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
# for i in map_data:
#     print(i)
#
# reduce = reduce(lambda x, y: x + y, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
# print(reduce)


#创建队列lingfuli111
# from queue import Queue
# q = Queue()
# str = "hellp"
# q.put(str)
# print(q.get())


# import json
# import time
# import requests
# from Crypto.Cipher import AES
# from Crypto.Util.Padding import pad
# import base64
#
# from spider_example.行行查.hanghangcha import cookies
#
#
# class AESCipher:
#     def __init__(self, key, iv):
#         self.key = key.encode('utf-8')
#         self.iv = iv.encode('utf-8')
#
#     def encrypt(self, data):
#         # 创建AES加密器，CBC模式
#         cipher = AES.new(self.key, AES.MODE_CBC, self.iv)
#         # PKCS7填充
#         padded_data = pad(data.encode('utf-8'), AES.block_size)
#         # 加密
#         encrypted = cipher.encrypt(padded_data)
#         # 转换为16进制字符串（与前端CryptoJS.enc.Hex对应）
#         return encrypted.hex()
#
#
# def generate_encrypted_query(page_number):
#     # 密钥和IV（从前端代码提取）
#     key = "jo8j9wGw%6HbxfFn"
#     iv = "0123456789ABCDEF"
#
#     # 创建加密器
#     aes_cipher = AESCipher(key, iv)
#
#     # 构造请求参数（与前端一致）
#     params = {
#         "page": page_number,
#         "_ts": int(time.time() * 1000)  # 时间戳，毫秒级
#     }
#
#     # JSON序列化
#     json_string = json.dumps(params, separators=(',', ':'))  # 紧凑格式，与JSON.stringify一致
#
#     # 加密
#     encrypted_query = aes_cipher.encrypt(json_string)
#
#     print(f"加密前: {json_string}")
#     print(f"加密后: {encrypted_query}")
#
#     return encrypted_query
#
#
# def fetch_problem_data(page_number, url="https://www.mashangpa.com/api/problem-detail/5/data/"):
#     """
#     获取问题详情数据
#
#     Args:
#         page_number: 页码
#         base_url: 网站基础URL
#     """
#     # 生成加密参数
#     encrypted_xl = generate_encrypted_query(page_number)
#
#     # 构造请求体
#     payload = {
#         "xl": encrypted_xl
#     }
#
#     # 请求URL - problemId 固定为 5
#     cookies = {
#         'sessionid':'dd2t44drmgsw4v5hyr81sj0hce0cfj5z'
#
#     }
#
#
#     headers = {
#         'Content-Type': 'application/json',
#         'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
#     }
#
#     try:
#         response = requests.post(
#             url,
#             json=payload,
#             headers=headers,
#             timeout=10,
#             cookies=cookies
#         )
#
#         print(f"请求状态码: {response.status_code}")
#         print(f"响应内容: {response.json()}")
#
#         if response.status_code == 200:
#             return response.json()
#         else:
#             print(f"请求失败: {response.status_code}")
#             return None
#
#     except Exception as e:
#         print(f"请求异常: {e}")
#         return None
#
#
# # 使用示例
# if __name__ == "__main__":
#     # 获取第1页数据
#     # result = fetch_problem_data(1)
#     # if result:
#     #     print("获取数据成功!")
#     #     print(json.dumps(result, indent=2, ensure_ascii=False))
#
#     # 获取多页数据
#     for page in range(1, 6):  # 获取1-5页
#         print(f"\n正在获取第 {page} 页数据...")
#         data = fetch_problem_data(page)
#         if data:
#             print(f"第 {page} 页获取成功")
#         time.sleep(1)  # 避免请求过快

import requests

# from 甘肃 import headers

# headers = {
#     "Accept": "*/*",
#     "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
#     "Cache-Control": "no-cache",
#     "Connection": "keep-alive",
#     "Origin": "https://snake.timeline.ink",
#     "Pragma": "no-cache",
#     "Referer": "https://snake.timeline.ink/latest",
#     "Sec-Fetch-Dest": "empty",
#     "Sec-Fetch-Mode": "cors",
#     "Sec-Fetch-Site": "cross-site",
#     "Timeline-Client": "timelineweb",
#     "Timeline-Device": "0a4e3d29f498e67484a9d63b6ecb4223",
#     "Timeline-Pwd;": "",
#     "Timeline-User;": "",
#     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0",
#     "sec-ch-ua": "\"Chromium\";v=\"142\", \"Microsoft Edge\";v=\"142\", \"Not_A Brand\";v=\"99\"",
#     "sec-ch-ua-mobile": "?0",
#     "sec-ch-ua-platform": "\"Windows\""
# }
# url = "https://api.nguaduot.cn/snake/v4"
# params = {
#     "order": "date",
#     "seed": "1763101090487",
#     "no": "99999999",
#     "id": ""
# }
# response = requests.get(url, headers=headers, params=params)
#
# print(response.text)
# print(response)
#
#
tims = int(time.time() * 1000)

d = {
"User-Agent": "TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzE0Mi4wLjAuMCBTYWZhcmkvNTM3LjM2",
"channelId":40009,
"key": "A013F70DB97834C0A5492378BD76C53A",
"method": "GET",
"sVersion": 2,
"timeStamp": tims
}
headers ={
    "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36"
}

d.update( {
    "movieId":"18167",
    "orderType": 0,
    "uuid": "19a95ce03a2c8-027eba78c2ae538-26061b51-190140-19a95ce03a2c8",
    "WuKongReady":"h5"
})
c = urlencode(d)
hasdcode = md5(c.encode("utf-8")).hexdigest()

url = "https://piaofang.maoyan.com/dashboard-ajax/movie"
res = requests.get(url,headers=headers)

print(res.text)
